package SparkRDD.RDD算子.Transformations.聚合操作

import org.apache.spark.{SparkConf, SparkContext}
import org.junit.Test

class zipTest {
  val conf = new SparkConf().setMaster("local[6]").setAppName("test")
  val sc   = new SparkContext(conf)

  @Test
  def test{

    val a = sc.makeRDD(1 to 5,2)
    val b = sc.makeRDD(Seq("a","b","c","d","e"),2)

    val zip1 = a.zip(b)
    val zip2 = b.zip(a)

    zip1.collect().foreach(print(_))//(1,a)(2,b)(3,c)(4,d)(5,e)
    zip2.collect().foreach(print(_))//(a,1)(b,2)(c,3)(d,4)(e,5)

    sc.stop()
  }
}
